<?php
class QueryController extends AppController {
    var $helpers = array ('Html','Form');
    var $name = 'Query'; // riferimento alla cartella delle view

    public function index() {

		// Controller::loadModel('Agente');
//		$this->Agente->recursive=2;
		// print_r($this->Agente->find('all', array('recursive'=>2)));
		
		Controller::loadModel('User');
//		$this->Agente->recursive=2;
//		print_r($this->User->find('all', array('recursive'=>2)));
		$ret = $this->User->find('all', array('fields' => array('User.username','Group.descrizione')
											   ,'conditions' => array('username' => 'dario', 'password' => 'dario')
											   ,'recursive' => 2));

		print_r($ret);
//		print_r($this->Agente->find('all', array('recursive'=>2)));
		//$this->Agente->recursive=2;
	    //$this->Agente->id = $id;
		//die;
		
	    // $this->User->id = $id;
//		Controller::loadModel('User');
//		print_r($this->User->find('all', array('recursive'=> 1)));
		//die;

//		Controller::loadModel('Anagrafica');
//		print_r($this->Anagrafica->find('all', array('conditions' => array('Anagrafica.id' => '4'), 'recursive'=> 2)));

    }

}
?>